package cn.xtits.xtf.common.db.config;

import com.baidu.disconf.client.common.annotations.DisconfFile;
import com.baidu.disconf.client.common.annotations.DisconfUpdateService;
import com.baidu.disconf.client.common.update.IDisconfUpdate;
import cn.xtits.xtf.common.db.DynamicReloadDataSource;
import cn.xtits.xtf.common.spring.SpringContext;

/**
 *
 */
@DisconfFile(filename = "dynamic-datasource.properties")
@DisconfUpdateService(classes = {DBConfig.class})
public class DBConfig implements IDisconfUpdate {

    @Override
    public void reload() throws Exception {
        DynamicReloadDataSource reloadDataSource = (DynamicReloadDataSource) SpringContext.getBean(DynamicReloadDataSource.class);
        reloadDataSource.reload();
    }
}
